package db.parking.beans;


import java.sql.Timestamp;

import java.io.Serializable;

/**
 * Orders entity
 * @author G15
 *
 */
public class Orders implements Serializable, Comparable<Orders> {
	/**
	 *
	 */
	private static final long serialVersionUID = 1L;
	private int oid;
	private String uid;
	private String type;
	private String carNo = "0";
	private Timestamp startTime;
	private Timestamp leaveTime;
	
	public Orders()
	{}

	
	public Orders(String uid, String type, String carNo,
			Timestamp startTime, Timestamp leaveTime, int lotNo, String email,
			int status) {
		super();
		this.uid = uid;
		this.type = type;
		this.carNo = carNo;
		this.startTime = startTime;
		this.leaveTime = leaveTime;
		this.lotNo = lotNo;
		this.email = email;
		this.status = status;
	}

	public Timestamp getStartTime() {
		return startTime;
	}

	public void setStartTime(Timestamp startTime) {
		this.startTime = startTime;
	}

	public Timestamp getLeaveTime() {
		return leaveTime;
	}

	public void setLeaveTime(Timestamp leaveTime) {
		this.leaveTime = leaveTime;
	}


	public int getLotNo() {
		return lotNo;
	}

	public void setLotNo(int lotNo) {
		this.lotNo = lotNo;
	}
	private int lotNo;
	private String email;
	private int status;
	
	public String getType() {
		return type;
	}
	public void setType(String type) {
		this.type = type;
	}
	public String getCarNo() {
		return carNo;
	}
	public void setCarNo(String carNo) {
		this.carNo = carNo;
	}

	public int getOid() {
		return oid;
	}
	public void setOid(int oid) {
		this.oid = oid;
	}
	public String getUid() {
		return uid;
	}
	public void setUid(String uid) {
		this.uid = uid;
	}
	public int getStatus() {
		return status;
	}
	public void setStatus(int status) {
		this.status = status;
	}
	public String getEmail() {
		return email;
	}
	public void setEmail(String email) {
		this.email = email;
	}

	@Override
	public int compareTo(Orders o) {
		int retVal;
		if((this.getLeaveTime().getTime() - (o.getLeaveTime()).getTime())==0)
			retVal=0;
		else if((this.getLeaveTime().getTime() - (o.getLeaveTime()).getTime()) >0)
			retVal=1;
		else retVal =-1;
		return retVal;
	}	
}
